﻿using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Activation;
using Pku.BookStore.IServices;
using Pku.BookStore.Model;

namespace Pku.BookStore.Services
{
    [Serializable]
    [ServiceBehavior(IncludeExceptionDetailInFaults = true, ConcurrencyMode = ConcurrencyMode.Multiple)]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class EmployeeServices : IEmployeeServices
    {
        /// <summary>
        /// 获取实例名
        /// </summary>
        private DAL.EmployeeDAL employeeDAL
        {
            get
            {
                return new DAL.EmployeeDAL();
            }
        }

        /// <summary>
        /// 增加员工信息
        /// </summary>
        /// <param name="entity"></param>
        public int Add(EmployeeModel entity)
        {
            return employeeDAL.Add(entity);
        }

        /// <summary>
        /// 修改员工信息
        /// </summary>
        /// <param name="entity"></param>
        public bool Modify(EmployeeModel entity)
        {
            return employeeDAL.Modify(entity);
        }

        /// <summary>
        /// 搜索
        /// </summary>
        /// <returns></returns>
        public List<EmployeeModel> Search(EmployeeParam param)
        {
            return employeeDAL.Search(param);
        }

        /// <summary>
        /// 获取员工实体
        /// </summary>
        /// <param name="employeeID"></param>
        /// <returns></returns>
        public EmployeeModel GetEntityById(int employeeID)
        {
            return employeeDAL.GetEntityById(employeeID);
        }

        /// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="Str">关键字</param>
        /// <returns></returns>
        public bool Exist(string Str)
        {
            return employeeDAL.Exist(Str);
        }

        /// <summary>
        /// 修改最后登录信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool ModifyLast(EmployeeModel entity)
        {
            return employeeDAL.ModifyLast(entity);
        }

        /// <summary>
        /// 修改员工密码
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool ModifyPass(EmployeeModel entity)
        {
            return employeeDAL.ModifyPass(entity);
        }

        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public EmployeeModel Login(EmployeeModel entity)
        {
            return employeeDAL.Login(entity);
        }

    }
}
